<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>chatting</h1>
</body>
<script>
var ws = new WebSocket("ws://127.0.0.1:8080/ws/chat/");
ws.onopen = function(evt) {  //绑定连接事件
　　console.log("Connection open ...");
　　ws.send("发送的数据");
};

ws.onmessage = function(evt) {//绑定收到消息事件
　　console.log( "Received Message: " + evt.data);
};

ws.onclose = function(evt) { //绑定关闭或断开连接事件
　　console.log("Connection closed.");
};


</script>
</html>

